package com.airlines.crewassignment.daofocmysql.ruleverification;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.airlines.crewassignment.entity.ruleverification.RuleVerification;

/**
 * @author xxxx
 * @date 2018/05/07 16:15:34
 * @company xxxx Airlines
 * @description 规则验证
 */
public interface RuleVerificationMapper {

    /**
     * 添加 （返回主键ID）
     * @param ruleVerification
     * @return
     */
    int insert(RuleVerification ruleVerification);

    /**
     * 批量插入
     * @param ruleVerifications
     * @return
     */
    int batchInsert(List<RuleVerification> ruleVerifications);

    /**
     * 逻辑删除（将is_delete 标记为置为 1）
     * @param id
     * @return
     */
    int deleteLogic(Integer id);


    /**
     * 修改
     * @param ruleVerification
     * @return
     */
    int update(RuleVerification ruleVerification);


    /**
     * 通过主键查询
     * @param id
     * @return
     */
    RuleVerification get(Integer id);

    /**
     * 多条件查询
     * @param ruleVerification
     * @return
     */
    List<RuleVerification> list(RuleVerification ruleVerification);

    /**
     * 多条件模糊查询
     * @param ruleVerification
     * @return
     */
    List<RuleVerification> listByFuzzy(RuleVerification ruleVerification);

    /**
     * 根据日期逻辑删除检查结果，包含 beginDate，删除该日期之后的
     * @param date
     */
    void deleteLogicByAfterDate(Date date);

    /**
     * 根据日期范围删除规则检查结果
     * @param date
     */
	void deleteLogicByDate(@Param("flightDateStart")Date flightDateStart,@Param("flightDateEnd")Date flightDateEnd ,@Param("dutyCode") String dutyCode);

	/**
	 * 查询某段时间范围内的检查结果
	 * @param flightDateStart notnull
	 * @param flightDateEnd notnull
	 * @param dutyCode notnull
	 * @param workcode null
	 * @return
	 */
	List<RuleVerification>  listBetweenFlightDate(@Param("flightDateStart") Date flightDateStart, @Param("flightDateEnd")Date flightDateEnd,
			@Param("dutyCode") String dutyCode, @Param("workcode")String workcode);
}
